package leetcode.code0416;

public class Solution1 extends Solution416 {

	@Override
	public boolean canPartition(int[] nums) {
		return this.f(nums, 0, 0, 0);
	}

	private boolean f(int[] nums, int index, int a, int b) {
		if (nums.length == index) {
			return a == b;
		}
		if (this.f(nums, index + 1, a + nums[index], b) || this.f(nums, index + 1, a, b + nums[index])) {
			return true;
		}
		return false;
	}

	public static void main(String[] args) {
		Solution1 so = new Solution1();
		so.debug1();
		so.debug2();
	}

}
